home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / rpg / crossfir.92 / crossfir / crossfire-0.92.5 / utils / ad2c.script next >
Text File  |  1996-07-24  |  579b  |  44 lines

  1. #!/bin/sh
  2. #
  3. #    ad2c : Convert app-defaults file to C strings decls.
  4. #
  5. #    George Ferguson, ferguson@cs.rcohester.edu, 12 Nov 1990.
  6. #    Updated 19 Mar 1991 - Made it self-contained.
  7. #
  8.  
  9. sed -n '
  10. : read
  11. # remove comments
  12. /^!/d
  13. # remove blanks
  14. /^$/d
  15. # escape quotes
  16. s/"/\\"/g
  17. # escape backslash
  18. s/\\/\\\\/g
  19. # except the line continuation ones
  20. s/\\$//g
  21. # add leading quote
  22. s/^/"/
  23. #
  24. : test
  25. /\\$/b slash
  26. s/$/",/
  27. p
  28. n
  29. b read
  30. #
  31. : slash
  32. p
  33. n
  34. # just like "read" only does not add leading quote
  35. /^!/d
  36. /^$/d
  37. s/"/\\"/g
  38. s/\\\\/\\/g
  39. s/\\n/\\\\n/g
  40. s/\\t/\\\\t/g
  41. s/\\f/\\\\f/g
  42. s/\\b/\\\\b/g
  43. b test' "$@"
  44.